package com.ruoyi.operation.domain.vo;

import lombok.Data;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 用作树形图生成
 */
@Data
public class TGentaskTreeVo {
    private String id; //父节点id号，这里使用系统id，按照系统维度去生成
    private String name;    //父节点的name，是系统名称；子节点name，是表里的name
    private String type;    //清算、稽核、手动
    private String status;  //父节点状态，是一个综合值，需要根据所有子节点判断
    private String memo;
    private List<TGentaskTreeVo> children;

    public static class TaskstatusDict {
        public static final String COMPLETED = "2";
        public static final String IN_PROGRESS = "1";
        public static final String INCOMPLETE = "0";

        private static final Map<String, String> LABEL_MAP = new HashMap<>();
        static {
            LABEL_MAP.put(COMPLETED, "completed");
            LABEL_MAP.put(IN_PROGRESS, "inProgress");
            LABEL_MAP.put(INCOMPLETE, "incomplete");
        }

        public static String getTaskstatusLabel(String value) {
            return LABEL_MAP.getOrDefault(value, "未知状态");
        }
    }

}
